import 'dart:math';

import 'living.dart';
import 'talk_event.dart';

class NPC extends Living {
  List<String> sentences = [];
  NPC(Map map) : super(map){
    if (map == null) {
      map = {};
    }
    name = map['name'];
    id = map['id'];
    var list = map['sentences'] ?? [];
    for (var source in list) {
      sentences.add(source);
    }
    this.add(TalkEvent());
  }
  String randomSentence(){
    if (sentences == null || sentences.length == 0) {
      return '';
    }
    int index = Random.secure().nextInt(sentences.length);
    return sentences[index];
  }
}